﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Gola.VN.Scb.Web.Common.Models.UIProductModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: ViewData["Title"] %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="break_module">
    </div>
    <div class="subcontent">
        <script type="text/javascript">
    $(document).ready(function () {
        $("#chkPromo").addClass('<%:ViewData["$ChkPromoClass$"].ToString() %>');
        $("#chkDiscount").addClass('<%:ViewData["$ChkPriceClass$"].ToString() %>');
        var pid = <%: Model.CurrentCategoryId %>;
        
        function buildUrl(value){
             var url ="/san-pham/"+pid;
             if(value != '')
             {
                url += "/q"+value;
             }
             return url;
        };

        $("select[name='city']").change(function () {
            var id = this.options[this.selectedIndex].value;
            var token = "t-" + id + "/" + '';
            var key = '';
            $.get('/Product/GetToken', { token: token, keyword: key, id: pid }, function (data) {
                document.location.href = data;
            });
        });

        $("select[name='orderby']").change(function () {
            var orderby = this.options[this.selectedIndex].value;
            var key = '';
            var token = '<%: (ViewData["$FilterPriceRange$"].ToString()  + ViewData["$FilterProvider$"].ToString()) %>' 
                        +  '/o-' + orderby + 
                        '<%:(ViewData["$FilterPromotion$"].ToString() + ViewData["$FilterPriceChange$"].ToString())%>' ;

            document.location.href =buildUrl(token);
        });

        $("select[name='QuickIndex']").change(function () {
            var pageIndex = this.options[this.selectedIndex].value;
            var key = '';
            var token = '<%: ViewData["QueryValue"].ToString() %>' + "/p-" + pageIndex;
            
            document.location.href = buildUrl(token);
        });
   

        $("#chkPromo").click(function () {
            var key = '';
            var token = '<%:ViewData["QueryValue"].ToString() %>';
            if ($(this).hasClass("NFh")) {
                
                token = token.replace("/khuyen-mai", "");
            }
            else {
                
                token = token + '/khuyen-mai' ;
            }
            document.location.href = buildUrl(token);
            $(this).addClass("NFh");
              
        });

        $("#chkDiscount").click(function () {
            var key = '';
            var token = '<%:ViewData["QueryValue"].ToString() %>' ;
           
            if ($(this).hasClass("NFh"))  { 
                token = token.replace("/giam-gia", "");
            }
            else {
                token = token + '/giam-gia';
            }            
            document.location.href = buildUrl(token);
            $(this).addClass("NFh");
        });
    });
        </script>
        <div class="divfs bdall clfix">
            <ul class="listFter">
                <li style="display: none;"><span>Tỉnh/ thành phố:</span>
                    <select name="city" id="city">
                        <option>Tất cả</option>
                        <option value="73">An Giang</option>
                        <option value="80">Bà Rịa-Vũng Tàu</option>
                        <option value="88">Bắc Giang</option>
                        <option value="76">Bắc Kạn</option>
                        <option value="83">Bạc Liêu</option>
                        <option value="90">Bắc Ninh</option>
                        <option value="79">Bến Tre</option>
                        <option value="72">Bình Định</option>
                        <option value="94">Bình Dương</option>
                        <option value="100">Bình Phước</option>
                        <option value="87">Bình Thuận</option>
                        <option value="107">Cà Mau</option>
                        <option value="103">Cần Thơ</option>
                        <option value="84">Cao Bằng</option>
                        <option value="116">Đà Nẵng</option>
                        <option value="106">Đăk Lăk</option>
                        <option value="120">Đăk Nông</option>
                        <option value="123">Điện Biên</option>
                        <option value="97">Đồng Nai</option>
                        <option value="114">Đồng Tháp</option>
                        <option value="71">Gia Lai</option>
                        <option value="89">Hà Giang</option>
                        <option value="101">Hà Nam</option>
                        <option value="1">Hà Nội</option>
                        <option value="112">Hà Tĩnh</option>
                        <option value="99">Hải Dương</option>
                        <option value="70">Hải Phòng</option>
                        <option value="117">Hậu Giang</option>
                        <option value="115">Hoà Bình</option>
                        <option value="75">Hưng Yên</option>
                        <option value="111">Khánh Hoà</option>
                        <option value="109">Khánh Hòa</option>
                        <option value="69">Kiên Giang</option>
                        <option value="122">Kon Tum</option>
                        <option value="130">Lai Châu</option>
                        <option value="85">Lâm Đồng</option>
                        <option value="91">Lạng Sơn</option>
                        <option value="86">Lào Cai</option>
                        <option value="96">Long An</option>
                        <option value="128">Nam Định</option>
                        <option value="74">Nghệ An</option>
                        <option value="127">Ninh Bình</option>
                        <option value="82">Ninh Thuận</option>
                        <option value="124">Phú Thọ</option>
                        <option value="125">Phú Yên</option>
                        <option value="105">Quảng Bình</option>
                        <option value="92">Quảng Nam</option>
                        <option value="78">Quảng Ngãi</option>
                        <option value="77">Quảng Ninh</option>
                        <option value="110">Quảng Trị</option>
                        <option value="119">Sóc Trăng</option>
                        <option value="93">Sơn La</option>
                        <option value="95">Tây Ninh</option>
                        <option value="126">Thái Bình</option>
                        <option value="121">Thái Nguyên</option>
                        <option value="81">Thanh Hóa</option>
                        <option value="68">Thừa Thiên-Huế</option>
                        <option value="108">Tiền Giang</option>
                        <option value="98">TP Hồ Chí Minh</option>
                        <option value="113">Trà Vinh</option>
                        <option value="118">Tuyên Quang</option>
                        <option value="102">Vĩnh Long</option>
                        <option value="104">Vĩnh Phúc</option>
                        <option value="131">Yên Bái</option>
                    </select>
                </li>
                <li><span>Sắp xếp theo:</span>
                    <%: Html.DropDownList("orderby", (List<SelectListItem>)ViewData["OrderByData"])%>
                </li>
                <li><a id="chkPromo" href="javascript:" title="Khuyến mãi">Khuyến mãi</a> </li>
                <li><a id="chkDiscount" href="javascript:" title="Giảm giá">Giảm giá</a> </li>
            </ul>
        </div>
        <%
            Html.RenderPartial("PaginationUserControl", Model.ProductsByCategory);
            Html.RenderPartial("ProductsGridUserControl", Model.ProductsByCategory);
            Html.RenderPartial("PaginationUserControl", Model.ProductsByCategory);%>
    </div>
    <!--popup product infomation-->
    <div id="product_info" class="popup_block">
    </div>
    <!-- start using diplay gmaps-->
    <%foreach (var locationDetail in Model.ProviderLocations)
      {
          Html.RenderPartial("LocationDetail", locationDetail);
      }
    %>
    <!---end using display gmaps--->
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="LeftPanel" runat="server">
    <div class="left_menu_home">
        <div class="title">
            <div class="fl">
            </div>
            <div class="fc">
                <a href="/">DANH MỤC SẢN PHẨM</a></div>
            <div class="fr">
            </div>
        </div>
    </div>
    <div class="break_module">
    </div>
    <%Html.RenderPartial("FilterPanel", Model.FilterData); %>
</asp:Content>
